﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="QuanLyPhanQuyen.aspx.cs" Inherits="ChamCong.Admin.QuanLyPhanQuyen" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript">
        function checkEmpty() {
            var mObj = document.getElementById('tbxTenRole').value;
            if (mObj == "") {
                alert('Vui lòng điền đầy đủ thông tin role!');
                return false;
            }
            else {
                return true;
            }
        }
    </script>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
        <asp:Menu ID="Menu1" runat="server" Orientation="Horizontal" CssClass="childMenu" SkipLinkText="">
            <Items>
                <asp:MenuItem Text="Phân quyền" Value="" NavigateUrl="~/Admin/QuanLyPhanQuyen.aspx?tt=pq">
                </asp:MenuItem>
                <asp:MenuItem Text="Quản lý role" Value="" NavigateUrl="~/Admin/QuanLyPhanQuyen.aspx?tt=qlr">
                </asp:MenuItem>
            </Items>        
        </asp:Menu>
    </div>

    <asp:UpdatePanel ID="upQLR" runat="server" Visible="False">
        <ContentTemplate>
        <div style="width: 700px;">
            <asp:Panel ID="pnlQLR" runat="server">
                <div style="width: 350px; float: left;">
                    <table style="width: 100%">
                        <tr>
                            <td>
                                Mã Role:</td>
                            <td>
                                <asp:TextBox ID="tbxIDRole" runat="server" Enabled="False"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Tên Role:</td>
                            <td>
                                <asp:TextBox ID="tbxTenRole" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Button class="button" ID="btnThemRole" runat="server" OnClientClick="return checkEmpty()" onclick="btnThemRole_Click" 
                                    Text="Thêm role mới" />
                                <asp:Button ID="btnCapNhatRole" runat="server" CssClass="button" 
                                    onclick="btnCapNhatRole_Click" Text="Cập nhật" Visible="False" />
                            </td>
                            <td>
                                <asp:Button ID="btnQuayLai" runat="server" CssClass="button" 
                                    onclick="btnQuayLai_Click" Text="Quay lại" Visible="False" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <sbc:sbcMsgBox ID="sbcMsgBox1" runat="server" UseJQuery="True" />
                            </td>
                        </tr>
                    </table>

                </div>

                <div style="width: 350px; float: right;">
                    <asp:GridView ID="dvDanhSachRole" runat="server" Height="50px" 
                        AutoGenerateColumns="False" DataSourceID="layTatCaRole" 
                        onrowdatabound="dvDanhSachRole_RowDataBound" CellPadding="4" 
                        ForeColor="#333333" GridLines="None">
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                            <asp:BoundField DataField="MaRole" HeaderText="MaRole" 
                                SortExpression="MaRole" />
                            <asp:BoundField DataField="TenRole" HeaderText="TenRole" 
                                SortExpression="TenRole" />
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:ImageButton ID="imgbtXem" ImageUrl="~/Scripts/Image/Xem.jpg" Width="18px" Height="18px" runat="server" />  
                                    <asp:ImageButton ID="imgbtSua" ImageUrl="~/Scripts/Image/Sua.jpg" Width="18px" Height="18px" runat="server" OnClick="imgbtSua_Click" />
                                    <asp:ImageButton ID="imgbtXoa" ImageUrl="~/Scripts/Image/Xoa.jpg" Width="18px" Height="18px" runat="server" OnClick="imgbtXoa_Click" />                      
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <EditRowStyle BackColor="#2461BF" />
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#EFF3FB" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#F5F7FB" />
                        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                        <SortedDescendingCellStyle BackColor="#E9EBEF" />
                        <SortedDescendingHeaderStyle BackColor="#4870BE" />
                    </asp:GridView>     
                </div>   
            </asp:Panel>                   
        </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:UpdatePanel ID="upPQ" runat="server" Visible="False">
        <ContentTemplate>
            <asp:Panel ID="pnlPQ" runat="server" >
                <div style="float:left; width: 300px;">
                    <asp:TreeView ID="tvwUsers" runat="server" 
                        onselectednodechanged="tvwUsers_SelectedNodeChanged" SkipLinkText="">
                    </asp:TreeView>
                </div>
                <div style="float:left; width: 300px;">
                    <asp:Panel ID="pnlThongTinNV" runat="server" Visible="False">
                        <table class="ui-accordion">
                            <tr>
                                <td>
                                    Họ tên:</td>
                                <td>
                                    <asp:Label ID="lblHoTenNV" runat="server" Font-Bold="True" ForeColor="#FF6600"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Phòng ban:</td>
                                <td>
                                    <asp:Label ID="lblPhongBan" runat="server" Text=""></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Roles</td>
                                <td>
                                    &nbsp;</td>
                            </tr>
                        </table>
                    </asp:Panel>
                    <asp:CheckBoxList ID="cblDanhSachRole" runat="server">
                    </asp:CheckBoxList>
                    <asp:Button ID="btnCapNhat" runat="server" Text="Cập nhật" 
                        onclick="btnCapNhat_Click" Width="90px" CssClass="button" 
                        Visible="False" />
                    <sbc:sbcMsgBox ID="sbcMsgBox2" runat="server" UseJQuery="True" />
                    <br />
                    <asp:ObjectDataSource ID="layTatCaRole" runat="server" 
                        SelectMethod="layTatCaRole" TypeName="BusinessLogicLayer.QuanLyPhanQuyenBLL">
                    </asp:ObjectDataSource>                
                </div>

            </asp:Panel>
        
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
